﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Axis.Dao.Research;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using Axis.BusinessObject.Research;
using Axis.Web.Administrator.Views.Lottory;

namespace Axis.Web.Views.Lottery.Services
{
    /// <summary>
    /// Summary description for AxisLottery
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class AxisLottery : System.Web.Services.WebService
    {

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetListMember(int ProjectID)
        {
            string Context = "";
            string InputValue = string.Format("<InputValue ProjectID=\"{0}\" Type=\"{1}\" {2}/>", ProjectID, 0, Context);
            IList<CUserResponse> Map = (new CResearchDao()).GetProjectResponseExportInObject(InputValue);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetCurrentResult(int ProjectID)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(new
            {
                LuckyNumber = CurrentInfo.LuckyNumber,
                LuckyName = CurrentInfo.LuckyName,
                TimeWait = CurrentInfo.TimeWait,
                LuckyGift = CurrentInfo.LuckyGift,
                ProjectName = CurrentInfo.ProjectName
            });
            return strJSON;
        }
    }
}